package cn.edu.neusoft.neufooddemo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

import cn.edu.neusoft.neufooddemo.R;
import cn.edu.neusoft.neufooddemo.bean.OrderInfo;

/**
 * Created by Shinelon on 2017/3/31.
 */

public class CartOrderAdapter extends RecyclerViewAdapter<CartOrderAdapter.ViewHolder>{

    public CartOrderAdapter(Context context, List data, int layoutResource) {
        super(context, data, layoutResource);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        final OrderInfo entity = (OrderInfo) data.get(position);
/*        holder.myorder_orderid.setText("订单号："+entity.getOrder_id());
        holder.myorder_itemid.setText(entity.getItem_id());
        holder.myorder_shopname.setText(entity.getShopname());*/
        holder.myorder_shopname.setText(entity.getShopname());
        holder.myorder_foodname.setText(entity.getFoodname());
        holder.myorder_price.setText("￥" + entity.getPrice());
        holder.myorder_num.setText(entity.getNum()+"个");

    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        TextView myorder_price, myorder_shopname, myorder_foodname, myorder_num;

        public ViewHolder(View itemView) {
            super(itemView);
            /*myorder_orderid = (TextView) itemView.findViewById(R.id.myorder_orderid);
            myorder_itemid = (TextView) itemView.findViewById(R.id.myorder_itemid);*/
            myorder_shopname = (TextView) itemView.findViewById(R.id.myorder_shopname);
            myorder_foodname = (TextView) itemView.findViewById(R.id.myorder_foodname);
            myorder_num = (TextView) itemView.findViewById(R.id.myorder_num);
            myorder_price = (TextView) itemView.findViewById(R.id.myorder_price);
        }

    }
}